#define SQLITE_OS_WIN
using Community.CsharpSqlite.Entity;

namespace Community.CsharpSqlite
{
    public partial class MutexHelper
    {
        /*
    ** 2007 August 28
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    **
    ** This file contains the common header for all mutex implementations.
    ** The sqliteInt.h header #includes this file so that it is available
    ** to all source files.  We break it out in an effort to keep the code
    ** better organized.
    **
    ** NOTE:  source files should *not* #include this header file directly.
    ** Source files should #include the sqliteInt.h file and let that file
    ** include this one indirectly.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2009-12-07 16:39:13 1ed88e9d01e9eda5cbc622e7614277f29bcc551c
    **
    **  $Header: Community.CsharpSqlite/src/mutex_h.cs,v bcbd36f24b23 2010/02/18 17:35:24 Noah $
    *************************************************************************
    */


        /*
    ** Figure out what version of the code to use.  The choices are
    **
    **   SQLITE_MUTEX_OMIT         No mutex logic.  Not even stubs.  The
    **                             mutexes implemention cannot be overridden
    **                             at start-time.
    **
    **   SQLITE_MUTEX_NOOP         For single-threaded applications.  No
    **                             mutual exclusion is provided.  But this
    **                             implementation can be overridden at
    **                             start-time.
    **
    **   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.
    **
    **   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.
    **
    **   SQLITE_MUTEX_OS2          For multi-threaded applications on OS/2.
    */

        //#if !SQLITE_THREADSAFE
        //# define SQLITE_MUTEX_OMIT
        //#endif
        //#if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP)
        //#  if SQLITE_OS_UNIX
        //#    define SQLITE_MUTEX_PTHREADS
        //#  elif SQLITE_OS_WIN
        //#    define SQLITE_MUTEX_W32
        //#  elif SQLITE_OS_OS2
        //#    define SQLITE_MUTEX_OS2
        //#  else
        //#    define SQLITE_MUTEX_NOOP
        //#  endif
        //#endif


#if SQLITE_MUTEX_OMIT

      

        public static sqlite3_mutex MutexAlloc(int iType)
        {
            return new sqlite3_mutex();
        }

//#define MutexAlloc(X)      ((sqlite3_mutex*)8)
        public static sqlite3_mutex sqlite3_mutex_alloc(int iType)
        {
            return new sqlite3_mutex();
        }

//#define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)
        public static void MutexFree(ref sqlite3_mutex m)
        {
        }

        //#define MutexFree(X)
        public static void MutexEnter(sqlite3_mutex m)
        {
        }

        //#define MutexEnter(X)
        public static int MutexTry(int iType)
        {
            return StatusCode.SQLITE_OK;
        }

        //#define MutexTry(X)      StatusCode.SQLITE_OK
        public static void MutexLeave(sqlite3_mutex m)
        {
        }

        //#define MutexLeave(X)
        public static bool MutexHeld(sqlite3_mutex m)
        {
            return true;
        }

//#define MutexHeld(X)     1
        public static bool MutexNotheld(sqlite3_mutex m)
        {
            return true;
        }

        //#define MutexNotheld(X)  1
        public static int MutexInit()
        {
            return StatusCode.SQLITE_OK;
        }

        //#define MutexInit()        StatusCode.SQLITE_OK
        public static void MutexEnd()
        {
        }

        //#define MutexEnd()
#endif
        //* defined(SQLITE_MUTEX_OMIT) */
    }
}